﻿using System;
using System.Collections;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using Rison.DataAccess.Data.ZJCP;
using Rison.BusinessFacade.Common;
using System.Web.SessionState;

namespace Rison.Web.ZJCP.ashx
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class load_characteristic_item : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/javascript";
            context.Response.Write(String.Format("_characteristicItem = {0};", loadCharacteristicItem()));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
        private string loadCharacteristicItem()
        {
            string sql = String.Format("select t1.depart_id, t3.Title, t3.ID from ExpertDepart t1, Expert t2, SelfExam_Grsb t3 where t1.ex_id=t2.ex_id and t2.ex_user_name='{0}' and t1.depart_id=t3.DepartID order by t3.Title", CurrentLoginedUser.UserName);
            DataSet ds = DbAccess.executeQuery(sql);
            return JsonCommon.ds2json(ds);
        }
    }
}
